﻿using FluentNHibernate.Mapping;

namespace SevenDigital.EndUserManagement.Core.Mapping
{
	public class UserMap : ClassMap<User>
	{
		//look at using fluent's convention classes.
		public UserMap() {
			Table("tblUser");
			Id(x => x.Id);

			Map(x => x.Email, "emailAddress");
			Map(x => x.Password, "password");
			Map(x => x.Username, "userIdentifier");

			Component(x => x.SecurityToken,
			          m =>{
			          	m.Map(x => x.ExpirationDate, "securityTokenExpirationDate");
			          	m.Map(x => x.ResetToken, "securityToken");
			          })
				.Access.ReadOnlyPropertyThroughPascalCaseField(Prefix.Underscore);
		}
	}
}